package hutool;

import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author DengZhiYuan
 * @version 1.0
 * @date 2022/12/5 14:52
 */
public class HutoolUtilTest {

    public static void main(String[] args) {
//        System.out.println(IdUtil.getSnowflake().nextId());
//        HutoolUtilTest hutoolUtilTest = new HutoolUtilTest();
//        hutoolUtilTest.projectTest();
        System.out.println(IdUtil.fastSimpleUUID().substring(0, 21));
    }

    public void idTest(){
        System.out.println(IdUtil.getSnowflake(1, 1).nextId());
        System.out.println(IdUtil.getSnowflake().nextId());
    }

    public void projectTest(){
        String projectCode = "[\n" +
                "    {\n" +
                "        \"refundMoney\": -6850,\n" +
                "        \"claimMoney\": 6850,\n" +
                "        \"projectCode\": \"HLS22B1010B153\",\n" +
                "        \"settleney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 41480,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1020B153\",\n" +
                "        \"settleMony\": 41480\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": -685,\n" +
                "        \"claimMoney\": 685,\n" +
                "        \"projectCode\": \"HLS22C1004B154\",\n" +
                "        \"settleMoey\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 164625,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1012B153\",\n" +
                "        \"settleMoey\": 164625\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": -22350,\n" +
                "        \"claimMoney\": 22350,\n" +
                "        \"projectCode\": \"HLS22B1006B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": -1140,\n" +
                "        \"claimMoney\": 1140,\n" +
                "        \"projectCode\": \"HLS22B1019B153\",\n" +
                "        \"settleoey\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1015B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1002B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1006B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1010D154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1014B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1016D154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1009B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1003B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1021B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1014B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1012B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1001U105\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1003B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1009B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1017B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1015B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1013B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1007B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1008B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS2261001B105\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1018B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1008B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1001B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1017B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1005B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1007B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1002B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22C1011B154\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS22B1013B153\",\n" +
                "        \"settleMoney\": 0\n" +
                "    },\n" +
                "    {\n" +
                "        \"refundMoney\": 0,\n" +
                "        \"claimMoney\": 0,\n" +
                "        \"projectCode\": \"HLS2251001U105\",\n" +
                "        \"settleMoney\": 0\n" +
                "    }\n" +
                "]";

        JSONArray jsonArray = JSONUtil.parseArray(projectCode);
        List<String> code = new ArrayList<>();
        for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            code.add(jsonObject.get("projectCode").toString());
//            System.out.println("'"+jsonObject.get("projectCode")+"',");

        }
        Collections.sort(code);
        for (String item : code) {
            System.out.println(item);
        }
    }


}
